#include <vector>
#include <iostream>

using namespace std;

class Solution {
public:
    vector<int> twoSum(vector<int>& numbers, int target) {
        int start = 0;
        int end = numbers.size() - 1;
        while (1) {
            int64_t sum = numbers[start] + numbers[end];
            if (sum == target) {
                return {start + 1, end + 1};
            } else if (sum < target) {
                start++;
            } else {
                end--;
            }
        }
    }
};

int main() {
    Solution solution;
    vector<int> numbers = {2, 7, 11, 15};
    int target = 9;
    vector<int> out = solution.twoSum(numbers, target);
    cout << "[" << out[0] << ", " << out[1] << "]" << endl;
    return 0;
}

